	lui $s0, 0xFFFF
	jal turnOffInterrupts
	addiu $a0, $zero, 0xF
	jal SevenSegEnable
	addu $a0, $zero $zero
chSW:	lw $t0, 0x40($s0)
	sw $t0, ($s0)
	xor $t1, $s1, $t0
	xor $t2, $t0, $zero
	and $t1, $t2, $t1
	addu $s1, $zero, $t0
	bnez $t1, count
	j chSW
	
count:	addiu $a0, $a0, 1
	xori $a1, $a1, 0xF
	jal SevenSegDisplay
	j chSW

#########################################
######### display 7 segs ################
######    a0 = numbers
######    a1 = dots
SevenSegDisplay:
andi $t0, $a1, 0x000F		#takes the 4 bits of dot argument
ori $t0, $t0, 0x00F0		#enables write mask for all digits
sll $t0, $t0, 16		#shifts bits up by 16 bits
andi $t1, $a0, 0xFFFF		#takes the 16 bits of the number that are important
or $t0, $t0, $t1		#add with 16 bits numbers to the rest of the value
lui $t1, 0xFFFF			#preping address in t1
sw $t0, 0x84($t1)		#writes value to seven 7 controller
jr $ra				#returns 
#########################################
########### enable 7 segs ###############
###### a0 = digits to enable
SevenSegEnable:
andi $t0, $a0, 0x000F		#takes the 4 bits of the digits
lui $t1, 0xFFFF			#preping address in t1
sw $t0, 0x80($t1)		#writes value to seven 7 controller
jr $ra

######### turn off interrupts
turnOffInterrupts:	mfc0 $t0, $12
			andi $t0, $t0, -2 #turn off intterrupt enable bit
			mtc0 $t0, $12
			jr $ra

